package com.wangs.order.controller;

import com.wangs.order.entity.Order;
import com.wangs.order.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderContoller {

    @Autowired
    private IOrderService orderService;


    @RequestMapping("/findAll")
    public List<Order> findAll() {
        return orderService.findAll();
    }

    @RequestMapping("/add")
    public String add() {
        Order order = new Order();
        order.setId(2l);
        order.setProductId(2l);
        order.setProductCount(100);
        order.setStatus(1);

        orderService.create(order);
        return "下单成功！";
    }
}
